package com.ultrawise.survey.common;

import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Properties;

import com.ultrawise.survey.common.utils.WebPath;

public class Systemconfig
{
	static private Properties prop = new Properties();

	Systemconfig()
	{
	}

	public static URL getAbsolutePathWithClass(Class clazz)
	{
		return clazz.getResource("");
	}

	public static void load(String path)
	{
		FileInputStream stream = null;
		try
		{
			stream = new FileInputStream(path);
			prop.load(stream);
		} catch (Exception e)
		{
			e.printStackTrace();
		} finally{
			try {
				stream.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
			stream = null;
		}
	}

	public static String getProperty(String key)
	{
		load(WebPath.getAbsolutePathWithClass() + "systemconfig.properties");
		return prop.getProperty(key);
	}

	public static void main(String args[])
	{
		// System.out.println(CdformConfig.getProperty("upload.file.realpath"));
	}
}
